package com.example.demo.bean;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * @author gatts, 2020/8/4 21:51
 */
@Component
@PropertySource(value = "classpath:author.properties")
@ConfigurationProperties(prefix = "author")
public class Author {

    private String name;

    private String address;

    @Override
    public String toString() {
        return "Author{" +
                "name='" + name + '\'' +
                ", address='" + address + '\'' +
                '}';
    }

    //- 这个注入就需要set方法了
    public void setAddress(String address) {
        this.address = address;
    }

    public void setName(String name) {
        this.name = name;
    }
}
